#ifndef __NU_API_H__
#define __NU_API_H__

//==============================================================================
// Types
//==============================================================================

//typedef void            M4OSA_Void;
#define M4OSA_NULL      0x00
//typedef signed char     M4OSA_Int8;
//typedef M4OSA_Int8*  M4OSA_MemAddr8;
//typedef unsigned long   M4OSA_UInt32;

#include "../NXP_MP4Enc/M4ViEncAPI.h"
typedef unsigned char        Uint8;
typedef unsigned short       Uint16;
typedef unsigned long        Uint32;
typedef unsigned long long   Uint64;
typedef unsigned short       Bool;
typedef unsigned long        Bool32;

struct TAPI_RESPONSE_TBL;

typedef struct
{
    Uint32 pa;
    Uint32 va;
    Uint16 numEntries;
    Uint8 access;
    Uint8 cacheAndBufferAble;
    Uint8 domain;
} nuMmu_SectInfo;

typedef struct
{
    Uint32 pa;
    Uint32 va;
    Uint32 coarseOrFineTtb;
    Uint16 numEntries;
    Uint8 ap0;
    Uint8 ap1;
    Uint8 ap2;
    Uint8 ap3;
    Uint8 cacheAndBufferAble;
    Uint8 domain;
} nuMmu_SmallPageInfo;

typedef struct
{
    Uint32      controlCode1;
    Uint32      controlCode2;
    Uint8     * inbuf;
    Uint8     * outbuf;
    Uint32      inbufsize;
    Uint32      outbufsize;
    Uint32      outbufused;
    Uint32      retvalue;
} nuDevice_Payload;

typedef struct
{
    Uint16  event_id;
    Uint16  x;
    Uint16  y;
    Uint16  ch[11];
} nuTouchEvent;

typedef struct {
   Uint16    adc1;          /* channel 1 */
   Uint16    adc2;          /* channel 2 */
   Uint16    adc3;          /* channel 3  */
   Uint16    adc4_bt;       /* battery type*/
   Uint16    adc5_btemp;    /* battery temp*/
   Uint16    adc6_usbvbus;  /* USB Vbus voltage*/
   Uint16    adc7_vbkp;     /* backup batt voltage*/
   Uint16    adc8_ichg;     /* batt charger current*/
   Uint16    adc9_vchg;     /* batt charger voltage*/
   Uint16    adc10_vbat;    /* batt voltage*/
   Uint16    adc11_hotdie;  /*die temperature sensing */
   Uint16    chanCollisionFlags;  /* bib map of channel errors */
} BspTwl3029_MadcResults;

typedef struct {
    Uint16 Vbat_max; /*Max.value of Vbat in mV*/
    Uint16 Vbat_min; /*Min.value of Vbat in mV*/
    Uint16 Vbat_in_mV; /*Current value of Vbat in mV */
    Uint16 Vbat; /*Current value of Vbat(raw MADC value) */
    Uint16 Btemp;
    Uint16 Btype;
} BattMgrBattVal;

typedef struct
{
    BspTwl3029_MadcResults ADC_results; /**< The MADC outputs of all the channels */
}AsyncConvResults;

typedef AsyncConvResults BattMgrAsyncConvUpdate;

typedef struct {
    unsigned long   keycode;
    unsigned long   event_id;
}nuKeyEvent;

enum {
    GSENSOR_NONE_INTERRUPT          = 0x0000,
    GSENSOR_OVERRUN_INTERRUPT       = 0x0001,
    GSENSOR_WATERMARK_INTERRUPT     = 0x0002,
    GSENSOR_FREEFALL_INTERRUPT      = 0x0004,
    GSENSOR_INACTIVITY_INTERRUPT    = 0x0008,
    GSENSOR_ACTIVITY_INTERRUPT      = 0x0010,
    GSENSOR_DOUBLE_TAP_INTERRUPT    = 0x0020,
    GSENSOR_SINGLE_TAP_INTERRUPT    = 0x0040,
    GSENSOR_DATA_READY_INTERRUPT    = 0x0080,

    GSENSOR_ROTATE_UP_INTERRUPT     = 0x0100,
    GSENSOR_ROTATE_DOWN_INTERRUPT   = 0x0200,
    GSENSOR_ROTATE_LEFT_INTERRUPT   = 0x0300,
    GSENSOR_ROTATE_RIGHT_INTERRUPT  = 0x0400,
    GSENSOR_ROTATE_TOP_INTERRUPT    = 0x0500,
    GSENSOR_ROTATE_BOTTOM_INTERRUPT = 0x0600,
    GSENSOR_ROTATE_ZERO_INTERRUPT   = 0x0700,
    GSENSOR_ROTATE_INTERRUPT        = 0x0F00,

    GSENSOR_SHAKE_INTERRUPT         = 0x4000,
    GSENSOR_REPEAT_INTERRUPT        = 0x8000,

    GSENSOR_SWITCH_INTERRUPT        = 0xFFFF
};

enum {
    GSENSOR_UP      = 0x0100,
    GSENSOR_DOWN    = 0x0200,
    GSENSOR_LEFT    = 0x0300,
    GSENSOR_RIGHT   = 0x0400,
    GSENSOR_TOP     = 0x0500,
    GSENSOR_BOTTOM  = 0x0600,
    GSENSOR_ZERO    = 0x0700
};

typedef struct
{
    Uint16  x;
    Uint16  y;
    Uint16  z;
} nuGSensorData;

enum {
    GSENSOR_NONE_INT_ENABLE     = 0,
    GSENSOR_DOUBLE_TAP_ENABLE   = 1,
    GSENSOR_SHAKE_ENABLE        = 2,
    GSENSOR_RUNNER_ENABLE       = 3
};

enum {
    GSENSOR_EventCallBack     = 0,
    GSENSOR_DataCallBack      = 1,
};
//typedef struct {
//    void *(*memory_allocate)(unsigned pool_index);
//    void *(*memory_startup_allocate)(unsigned pool_index);
//    void (*memory_free)(void *memory_ptr);
//    void (*memory_init)(unsigned pool_index, void *start_addr);
//    void (*memory_deinit)(unsigned pool_index);
//} NU_DRIVER_PARTITION_MEMORY_POOL;

//enum POOL_INDEX {
//    TAPI_POOL_INDEX     = 0,
//    KEYPAD_POOL_INDEX   = 1,
//    TOUCH_POOL_INDEX    = 2,
//};


typedef struct {
    Uint32 (*SetAlarmTime)(void * pRTCTime);
    Uint32 (*UnSetAlarm)(void);
    Uint32 (*GetAlarmTime)(void * pRTCTime);
    Uint32 (*SetPeriodicTimerEnable)(void *pPeriodCallBack, Uint8 period);
    Uint32 (*SetPeriodicTimerDisable)(void);
    Uint32 (*GetRTCTime)(void *pRTCTime);
    Uint32 (*SetRTCTime)(void *pRTCTime);
    void   (*SetEventAddress)(Uint32 EventAddress);
} nu_rtcDriver;

typedef void (*Light_Sensor_AdcCallback)(Uint16 result);



typedef struct BatteryCallback {
    void  (*ChgStartNotifyCallback) (void);
    Uint8 (* StopChgNotifyCallback) (void);
    void  (*ChgUnknownNotifyCallback) (void);
    void  (*ChgFailNotifyCallback) (unsigned char cause);
    void  (*CritVoltNotifyCallback) (unsigned short vbat);
//    void  (*BattValNotifyCallback) (BattMgrBattVal Batt_val);
    void  (*ChgPlgNotifyCallback) (unsigned char chgsts);
    void  (*AsyncConvResultsNotifyCallback)(BattMgrAsyncConvUpdate async_conv_results);
    void  (*BatteryCapacityCallback) (Uint8 capacity);
    void  (*LowBatteryCallback) (Uint16 vbat);
    void  (*ChgFinishNotifyCallback) (Uint16 vbat);
} BatteryCallbackS;

typedef struct {
    void (*GetBatteryChargingDevice)(int *pDevice);
    void (*GetBatteryChargingCurrent)(int *pCurrent);
    void (*GetBatteryChargingValtage)(int *pVoltage);
    void (*GetBatteryChargingTemp)(int *pTemp);
    void (*RegisterBatteryCallback)(BatteryCallbackS *pBatteryCallbacks);//BatteryCallbackS *pBatteryCallbacks
    Uint8 (*GetBatteryChargingPathState)(void);
    Uint16 (*GetBattCapacity)(void);
} Nu_BatteryAPIS;

typedef struct outBtTable{
    void* phead;
    void (*APP_Init)(void);
    void (*APP_DeInit)(void);
    void (*APP_ProcessUserAction)(unsigned char appMsgRcvId, unsigned char* msg, char* databuff, int* plen);
    void*(*mem_allocate)(unsigned alloc_size);
    void*(*mem_startup_allocate)(unsigned alloc_size);
    int  (*mem_free)(void *memory_ptr);
    int  (*mem_init)(void *start_addr, unsigned size);
    int  (*mem_deinit)(void);

}outBtTable;

typedef struct inBtTable{
    int  (*CAS)(int * destination, int ovalue, int nvalue);
    void * event_bt;
    void * event_pei_bt;
    int  (*ela_btstate)();
}inBtTable;

#define BTL_EVENT       0x4


typedef enum {
    TI_CMD_CameraInit           = 0,
    TI_CMD_CameraBeginPreview   = 1,
    TI_CMD_CameraStopPreview    = 2,
    TI_CMD_CameraSnapshot       = 3,
    TI_CMD_CameraDele           = 4,
    TI_CMD_Fs_Init              = 5,
    TI_CMD_Fs_DeInit            = 6,
    TI_CMD_Fs_Open              = 7,
    TI_CMD_Fs_Close             = 8,
    TI_CMD_Fs_Read              = 9,
    TI_CMD_Fs_Write             = 10,
    TI_CMD_Fs_Remove            = 11,
    TI_CMD_Fs_Flush             = 12,
    TI_CMD_Fs_Stat              = 13,
    TI_CMD_Fs_Tell              = 14,
    TI_CMD_Fs_Seek              = 15,
    TI_CMD_Fs_Mkdir             = 16,
    TI_CMD_Fs_Rmdir             = 17,
    TI_CMD_Fs_OpenDir           = 18,
    TI_CMD_Fs_ReadNextDir       = 19,
    TI_CMD_Fs_CloseDir          = 20,
    TI_CMD_Fs_Rename            = 21,
    TI_CMD_MAX,
} TI_COMMNAD;

//==============================================================================
// NU APIs
//==============================================================================

typedef void (*bspDisplay_ELcdDMACallback)(void);

#ifndef _zener

extern void *g_NucleusApiForZener[];
void InitNucleusApiForZener(void);

void InitNucleusDeviceForZener(void);

typedef void (*DeviceHandlerType)(nuDevice_Payload *);

//
// NU APIs for loader
//
int  nu_Schedule_TimerControl(int enable);
void nu_getMmuSectInfo(nuMmu_SectInfo **ppSectInfo, Uint8 *pSize);
void nu_getMmuSmallPageInfo(nuMmu_SmallPageInfo **ppSmallPageInfo, Uint8 *pSize);
void nu_timer(int nJumpPoint, void *pTimerStack, int *pTimerContext, int *pPreemption, Bool32 *pElastosSleeped, Bool32 *pAllDevicesDown, int *pschedule, int *pDebug);
void nu_sleep(int ticks);

unsigned long nu_uart_sendData( unsigned char *dataPtr, unsigned long dataLen );
unsigned long nu_uart_receiveData( unsigned char *dataPtr, unsigned long dataLen );

int nu_displayInit(void);
int nu_displayLoad(Uint8* addr, Uint16 x, Uint16 y, Uint16 width, Uint16 height, Uint16 stride, Uint16 dstLeft, Uint16 dstTop, Uint16 orientation);
int nu_displayShutDown(void);
int nu_displaySetPartialUpdateAddr(int x, int y, int width, int height);
int nu_bspDisplaySetRotationDegree(int x);
void nu_bspDisplayEnableTeModeAndSetRotate(Uint32 status);
void nu_bspDisplayDisableTeMode(void);
void nu_bspDisplayELcdDMACallbackReg(bspDisplay_ELcdDMACallback userBuffer2frameFuffer, bspDisplay_ELcdDMACallback frameBuffer2LCD);

struct TAPI_ATCMD_TBL * nu_ACI_GetCommand(void);
void nu_ACI_RegisterCallback(struct TAPI_RESPONSE_TBL  *);
struct TAPI_BAT_TBL *nu_BAT_GetAPIs(void);
struct NU_TAPI_MEMORY_POOL * nu_getTapiMemoryPool(void);
struct NU_TAPI_PPP *nu_getTapiPPP(void);

void nu_notifyDeviceCaller(Uint32 event, Uint32 state);
void nu_notifyDeviceCallerByHISR(Uint32 event, Uint32 state);

void nu_getRTCTime(void *pRTCTime);
void nu_setRTCTime(void *pRTCTime);

void nu_initUsbMass(void (*UsbCallback)(int usbEvent, void *ctx));
void nu_usbMassEnable(int bMass);

void nu_initUsbsync(void (*UsbsyncCallback)(char *pbuf, int len, int SyncEvent));
int nu_Get_UsbSyncReady(void);
void nu_UsbsyncEnable(int state);
int nu_diolink_write(void *pbuf, unsigned int *size);

void* nu_btl(inBtTable* intable);
void nu_set_event(int eventid);
void nu_PrintMemoryInfo(void);

int nu_Retrieve_Event(int timeout);

void nu_getMemoryPool(Uint32 *pStart, Uint32 *pEnd);

void nu_GSensorInit(nuGSensorData *pGSensorData, Uint32 *pEventData, Uint32 *takeBack, Uint32 completionEvent);
int nu_GSensorSubscribe(Uint8 Eventmode, Uint8 CallBackMode);
void nu_GSensorUnsubscribe(void);
void nu_GSensorSetFreq(Uint8 level);
void nu_GSensor_SetRotate(Uint8 type);
void nu_GSensor_SetSensitivity(Uint8 value);

Uint8 nu_ConfigVibrator(void * cbptr, Uint8 trimVoltage, Uint8 outputVoltage, Uint8 cycle);
Uint8 nu_EnableVibrator(void * cbptr, Uint8 enable);


//void **nu_FM_GetAPIs(void);

nu_rtcDriver *nu_GetRTCDriverAPI(void);

//void **nu_Camera_GetAPIs(void);
void nu_powerDown(void);

Nu_BatteryAPIS *nu_get_BatteryAPIs(void);

int nu_Audio_Config(long pathindex, int vol_level);
int nu_Audio_Write(short *buffer, unsigned long size);
int nu_Audio_Close(unsigned char sessionNum);
int nu_Audio_RegisterCallback(
    void (*AudioCallback)(unsigned char event), Uint8);

int nu_Audio_StartSession(unsigned char sessionNum,
                          unsigned long wakeupPeriod,
                          unsigned short uplinkLevel,
                          unsigned short downlinkLevel,
                          unsigned short uplinkSpeed,
                          unsigned short downlinkSpeed);

int nu_Audio_Init(void (*AudioCallback)(unsigned char session_num, unsigned char event),
                unsigned short sessionType,
                unsigned long buffer_size,
    short** ppShareBuffer,
    signed char *session_num);

int nu_Audio_SetAppStatus(unsigned char sessionNum, unsigned long writeOffset);
unsigned long nu_Audio_GetASFStatus(unsigned char sessionNum);

int nu_Audio_End(unsigned char sessionNum);
int nu_Audio_UpdateAppStatus(unsigned char sessionNum,
                             unsigned short uplinkLevel,
                             unsigned short downlinkLevel,
                             unsigned short uplinkSpeed,
                             unsigned short downlinkSpeed);

int audio_init(int sample_rate, int bits_per_sample, int channels);
int audio_end();
int audio_write(short *wav_buffer, unsigned long buffer_size, unsigned long *pCopy_Size);

//int nu_FMP3DEC_InitMP3Audio(
//    void * pMPEGInst,
//    FMP3Dec_MPEGParam_t * pParam);
//
//int nu_FMP3DEC_SearchForSyncword(
//    void                    *pMPEGInst,
//    void                    *pMPEGScratch,
//    FMP3DEC_MPEGBitstream_t *pBitstream,
//    unsigned int            length);
//
//int nu_FMP3DEC_DecodeInfo(
//    void                    *pMPEGInst,
//    void                    *pMPEGScratch,
//    FMP3DEC_MPEGBitstream_t *pBitstream,
//    FMP3DEC_MPEGHeader_t    *pMPEGHeader);
//
//int nu_FMP3DEC_DecodeData(
//    void                    *pMPEGInst,
//    void                    *pMPEGScratch,
//    PCM_t                   *pLeft,
//    PCM_t                   *pRight,
//    FMP3DEC_MPEGBitstream_t *pBitstream);
//
//int nu_FMP3DEC_GetInstanceSize(void);
//
//int nu_FMP3DEC_GetScratchSize(void);
//
//void nu_FMP3DEC_GetDecoderVersion(FMP3DEC_VERSIONINFO * VersionInfo);
//
//unsigned char nu_M4JPG_getEncoderVersion(M4JPG_Version *p_version);
//unsigned char nu_M4JPG_initEncoder(void **p_encoder_lib);
//unsigned char nu_M4JPG_destroyEncoder(void *p_encoder_lib);
//
//unsigned char nu_M4JPG_encode(void *p_encoder_lib,
//        M4JPG_Plane *p_raw_frame,
//        M4JPG_UInt32 *p_stream_size,
//        M4JPG_UInt8 *p_output_data);
//
//unsigned char nu_M4JPG_setEncoderParam(void *p_encoder_lib,
//        M4JPG_EncParam *p_encoder_param);

//Audio EQ
//LVM_ReturnStatus_en nu_LVM_GetVersionInfo(
//    LVM_VersionInfo  *pVersion);
//
//LVM_ReturnStatus_en nu_LVM_GetMemoryTable(
//    LVM_Handle_t         hInstance,
//    LVM_MemTab_t         *pMemoryTable,
//    LVM_InstParams_t     *pInstParams);
//
//LVM_ReturnStatus_en nu_LVM_GetInstanceHandle(
//    LVM_Handle_t        *phInstance,
//    LVM_MemTab_t        *pMemoryTable,
//    LVM_InstParams_t    *pInstParams);
//
//LVM_ReturnStatus_en nu_LVM_ClearAudioBuffers(LVM_Handle_t  hInstance);
//
//LVM_ReturnStatus_en nu_LVM_GetControlParameters(
//    LVM_Handle_t           hInstance,
//    LVM_ControlParams_t    *pParams);
//
//LVM_ReturnStatus_en nu_LVM_SetControlParameters(
//    LVM_Handle_t           hInstance,
//    LVM_ControlParams_t    *pParams);
//
//LVM_ReturnStatus_en nu_LVM_Process(
//    LVM_Handle_t                hInstance,
//    const LVM_INT16             *pInData,
//    LVM_INT16                   *pOutData,
//    LVM_UINT16                  NumSamples);
//
//LVM_ReturnStatus_en nu_LVM_SetHeadroomParams(
//    LVM_Handle_t            hInstance,
//    LVM_HeadroomParams_t    *pHeadroomParams);
//
//LVM_ReturnStatus_en nu_LVM_GetHeadroomParams(
//    LVM_Handle_t            hInstance,
//    LVM_HeadroomParams_t    *pHeadroomParams);
//void **nu_FM4VIFI_GetAPIs(void);

void **nu_TICommand_GetAPIs(void);
unsigned char nu_KeypadCheckState(void);
void nu_getTimer32kTicks(Uint32 *mswPtr, Uint32 *lswPtr);

void nu_ExceptionHandler(Uint32 *reg, Uint8 type);

Uint32 nu_GetPowerOnMode(void);
void nu_bspSoftwareReset(void);
void nu_bspPm_enableSleeps(Bool enableArmDeepSleep,
                           Bool enableArmSmallSleep,
                           Bool enableWcdmaClockSleep,
                           Bool enableDualModeClockSleep);

void nu_bspIdle_Gsp_enableArmDeepSleepDecision(Bool state);
//void nu_allDevicesShundown(void);
//void nu_allDevicesPowerOn(void);
//void  **nu_FM4ViDec_GetAPIs(void);
void  **nu_FM4ViEnc_GetAPIs(void);
//void  **nu_WMADec_GetAPIs(void);
//void  **nu_AACDec_GetAPIs(void);
//void  **nu_AMRNBDec_GetAPIs(void);
//void  **nu_AMRNBEnc_GetAPIs(void);

void nu_RegisterSDCardEvent(int eventid);
Uint32 nu_zenr_gbi_get_tfcard_blocks(void);

#else // _zener

extern void **g_NucleusApiForZener;
#define DEFINE_NU_API(func_ptr_type, index) \
            ((func_ptr_type)g_NucleusApiForZener[index])

//
// NU APIs for zener
//
//#define nu_puts                         DEFINE_NU_API(void (*)(const char *),                               0)
#define nu_getMmuSectInfo               DEFINE_NU_API(void (*)(nuMmu_SectInfo **, Uint8 *),                 1)
#define nu_getMmuSmallPageInfo          DEFINE_NU_API(void (*)(nuMmu_SmallPageInfo **, Uint8 *),            2)
#define nu_timer                        DEFINE_NU_API(void (*)(int , void *, int *, int *, Bool32 *, Bool32 *, Int32 *, Int32 *),         3)
#define nu_uart_sendData                DEFINE_NU_API(unsigned long (*)(unsigned char *, unsigned long),    4)
#define nu_uart_receiveData             DEFINE_NU_API(unsigned long (*)(unsigned char *, unsigned long),    5)
//#define nu_FlashFXDeviceOpen            DEFINE_NU_API(unsigned long (*)(Uint16),                            6)
//#define nu_FlashFXDeviceClose           DEFINE_NU_API(unsigned long (*)(Uint16),                            7)
//#define nu_FlashFXDeviceIO              DEFINE_NU_API(unsigned long (*)(Uint16, Uint16, void*, Uint16, Uint16),    8)
//#define nu_FlashFXDeviceIoctl           DEFINE_NU_API(unsigned long (*)(Uint16, Uint16,void*),              9)
#define nu_displayInit                  DEFINE_NU_API(int (*)(void),                                        10)
#define nu_displayLoad                  DEFINE_NU_API(int (*)(Uint8* addr, Uint16, Uint16, Uint16, Uint16, Uint16, Uint16, Uint16, Uint16), 11)
#define nu_displayShutDown              DEFINE_NU_API(int (*)(void),                                        12)
#define nu_ACI_GetCommand               DEFINE_NU_API(struct TAPI_ATCMD_TBL *(*)(void),                     13)
#define nu_ACI_RegisterCallback         DEFINE_NU_API(void (*)(struct TAPI_RESPONSE_TBL *),                 14)
//#define _nu_preAccessDevice             DEFINE_NU_API(int (*)(Uint32, nuDevice_Payload *, Uint32, Uint32 *),15)
//#define _nu_postAccessDevice            DEFINE_NU_API(void (*)(Uint32),                                     16)
#define nu_getRTCTime                   DEFINE_NU_API(void (*)(void *),                                     17)
#define nu_setRTCTime                   DEFINE_NU_API(void (*)(void *),                                     18)
//#define nu_init_touch                   DEFINE_NU_API(void (*)(void (*)(Uint16, int, int, Uint16 *)),       19)
#define nu_sleep                        DEFINE_NU_API(void (*)(int),                                        20)
//#define nu_initKeypad                   DEFINE_NU_API(void (*)(void (*)(unsigned char), void (*)(unsigned char)), 21)
#define nu_Retrieve_Event               DEFINE_NU_API(void (*)(int),                                        22)
#define nu_BAT_GetAPIs                  DEFINE_NU_API(struct TAPI_BAT_TBL * (*)(void),                      23)
#define nu_notifyDeviceCaller           DEFINE_NU_API(void (*)(Uint32, Uint32),                             24)
#define nu_getTapiMemoryPool            DEFINE_NU_API(struct NU_TAPI_MEMORY_POOL * (*)(void),               25)
#define nu_getMemoryPool                DEFINE_NU_API(void (*)(Uint32 *, Uint32 *),                         26)
#define nu_GSensorInit                  DEFINE_NU_API(void (*)(nuGSensorData *, Uint32 *, Uint32 *, Uint32),27)
#define nu_GSensorSubscribe             DEFINE_NU_API(int (*)(Uint8, Uint8),                                28)
#define nu_GSensorUnsubscribe           DEFINE_NU_API(void (*)(void),                                       29)
#define nu_set_event                    DEFINE_NU_API(void (*)(int),                                        30)
#define nu_btl                          DEFINE_NU_API(void* (*)(inBtTable* intable),                        31)
#define nu_ConfigVibrator               DEFINE_NU_API(Uint8 (*)(void *, Uint8, Uint8, Uint8),               32)
#define nu_EnableVibrator               DEFINE_NU_API(Uint8 (*)(void *, Uint8),                             33)
//#define nu_FM_GetAPIs                   DEFINE_NU_API(void ** (*)(void),                                    34)
//#define nu_setmode                      DEFINE_NU_API(Uint8 (*)(int),                                       35)
//#define nu_setwritearea                 DEFINE_NU_API(Uint8 (*)(unsigned char, unsigned, unsigned, unsigned), 36)
//#define nu_setwritetype                 DEFINE_NU_API(Uint8 (*)(unsigned short int),                        37)
#define nu_GetRTCDriverAPI              DEFINE_NU_API(nu_rtcDriver * (*)(void),                             38)
//#define nu_Camera_GetAPIs               DEFINE_NU_API(void ** (*)(void),                                    39)
#define nu_powerDown                    DEFINE_NU_API(void (*)(void),                                       40)
//#define nu_getMDTAPIs                   DEFINE_NU_API(Nu_MDTAPIS *(*)(void),                                41)
#define nu_get_BatteryAPIs              DEFINE_NU_API(Nu_BatteryAPIS *(*)(void),                            42)
//#define nu_touch_calibration_query      DEFINE_NU_API(Bool32 (*)(),                                         43)
//#define nu_touch_calibration_start      DEFINE_NU_API(void (*)(),                                           44)
//#define nu_touch_calibration_end        DEFINE_NU_API(void (*)(),                                           45)
//#define nu_Audio_Config                 DEFINE_NU_API(int (*)(long, int),                                   46)
//#define nu_Audio_Write                  DEFINE_NU_API(int (*)(short *, unsigned long),                      47)
//#define nu_Audio_Close                  DEFINE_NU_API(int (*)(unsigned char),                               48)
//#define nu_keypadLEDOn                  DEFINE_NU_API(void (*)(int),                                        49)
#define nu_getTapiPPP                   DEFINE_NU_API(struct NU_TAPI_PPP * (*)(void),                       50)
#define nu_GSensorSetFreq               DEFINE_NU_API(void (*)(Uint8),                                      51)
//#define nu_FMP3DEC_InitMP3Audio         DEFINE_NU_API(int (*)(void *, FMP3Dec_MPEGParam_t *),               52)
//#define nu_FMP3DEC_SearchForSyncword    DEFINE_NU_API(int (*)(void *, void *, FMP3DEC_MPEGBitstream_t *, unsigned int), 53)
//#define nu_FMP3DEC_DecodeInfo           DEFINE_NU_API(int (*)(void *, void *, FMP3DEC_MPEGBitstream_t *, FMP3DEC_MPEGHeader_t *),   54)
//#define nu_FMP3DEC_DecodeData           DEFINE_NU_API(int (*)(void *, void *, PCM_t *, PCM_t *, FMP3DEC_MPEGBitstream_t *),         55)
//#define nu_FMP3DEC_GetInstanceSize      DEFINE_NU_API(int (*)(void),                                        56)
//#define nu_FMP3DEC_GetScratchSize       DEFINE_NU_API(int (*)(void),                                        57)
//#define nu_FMP3DEC_GetDecoderVersion    DEFINE_NU_API(void (*)(FMP3DEC_VERSIONINFO *),                      58)
#define nu_initUsbMass                  DEFINE_NU_API(void (*)(void (*)(int, void *)),                      59)
#define nu_usbMassEnable                DEFINE_NU_API(void (*)(int),                                        60)
//#define nu_SetLcdBacklight_Level        DEFINE_NU_API(Uint16 (*)(Uint8),                                    61)
//#define nu_Backlight_On                 DEFINE_NU_API(void (*)(void),                                       62)
//#define nu_Backlight_Off                DEFINE_NU_API(void (*)(void),                                       63)
//#define nu_FIH_SD_Initial               DEFINE_NU_API(void (*)(void),                                       64)
//#define nu_FIH_SD_DeInitial             DEFINE_NU_API(void (*)(void),                                       65)
//#define nu_FIH_SD_Disk_GetTotalSize     DEFINE_NU_API(Uint32 (*)(void),                                     66)
//#define nu_FIH_SD_Disk_GetFreeSize      DEFINE_NU_API(Uint32 (*)(void),                                     67)
//#define nu_FIH_SD_Folder_Change         DEFINE_NU_API(Uint32 (*)(char*),                                    68)
//#define nu_FIH_SD_Folder_Rename         DEFINE_NU_API(Uint32 (*)(char* , char* ),                           69)
//#define nu_FIH_SD_File_Rename           DEFINE_NU_API(Uint32 (*)(char* , char* ),                           70)
//#define nu_FIH_SD_Folder_Make           DEFINE_NU_API(Uint32 (*)(char* ),                                   71)
//#define nu_FIH_SD_Folder_Remove         DEFINE_NU_API(Uint32 (*)(char* ),                                   72)
//#define nu_FIH_SD_File_Delete           DEFINE_NU_API(Uint32 (*)(char* ),                                   73)
//#define nu_FIH_SD_File_DeleteAll        DEFINE_NU_API(Uint32 (*)(void),                                     74)
//#define nu_FIH_SD_File_Open             DEFINE_NU_API(void* (*)(char* ,char* ),                             75)
//#define nu_FIH_SD_File_seek             DEFINE_NU_API(Uint32 (*)(void* , Uint32, Uint8 ),                   76)
//#define nu_FIH_SD_File_read             DEFINE_NU_API(Uint32 (*)(void* , Uint8*, Uint32 ),                  77)
//#define nu_FIH_SD_File_write            DEFINE_NU_API(Uint32 (*)(void* , Uint8*, Uint32 ),                  78)
//#define nu_FIH_SD_File_close            DEFINE_NU_API(Uint32 (*)(void* ),                                   79)
//#define nu_FIH_SD_GetSubFolerNum        DEFINE_NU_API(Uint32 (*)(void),                                     80)
//#define nu_FIH_SD_GetFileNum            DEFINE_NU_API(Uint32 (*)(void),                                     81)
//#define nu_FIH_SD_QuickFormat           DEFINE_NU_API(Uint32 (*)(void),                                     82)
//#define nu_FIH_SD_NormalFormat          DEFINE_NU_API(Uint32 (*)(void),                                     83)
//#define nu_FIH_SD_GetFolder             DEFINE_NU_API(Uint32 (*)(Uint32 , void *),                          84)
//#define nu_FIH_SD_GetFile               DEFINE_NU_API(Uint32 (*)(Uint32 , void *),                          85)
//#define nu_FIH_SD_File_Cut              DEFINE_NU_API(void (*)(void* ),                                     86)
//#define nu_FIH_SD_Folder_Cut            DEFINE_NU_API(void (*)(void* ),                                     87)
//#define nu_FIH_SD_File_Copy             DEFINE_NU_API(void (*)(void* ),                                     88)
//#define nu_FIH_SD_Folder_Copy           DEFINE_NU_API(void (*)(void* ),                                     89)
//#define nu_FIH_SD_Paste                 DEFINE_NU_API(Uint32 (*)(void),                                     90)
//#define nu_UFI_ReadFile                 DEFINE_NU_API(Uint32 (*)(Uint32, Uint32, Uint8 *),                  91)
//#define nu_UFI_WriteFile                DEFINE_NU_API(Uint32 (*)(Uint32, Uint32, Uint8 *),                  92)
//#define nu_Audio_RegisterCallback       DEFINE_NU_API(int (*)(void (*)(unsigned char), Uint8),               93)
//#define nu_Audio_Init                   DEFINE_NU_API(int (*)(void (*)(unsigned char, unsigned char), unsigned short, unsigned long, short**, signed char*),      94)
//#define nu_Audio_StartSession           DEFINE_NU_API(int (*)(unsigned char, unsigned long, unsigned short, unsigned short, unsigned short, unsigned short),    95)
//#define nu_Audio_SetAppStatus           DEFINE_NU_API(int (*)(unsigned char, unsigned long),                96)
//#define nu_Audio_GetASFStatus           DEFINE_NU_API(unsigned long (*)(unsigned char),                     97)
#define nu_PrintMemoryInfo              DEFINE_NU_API(void (*)(void),                                       98)
//#define nu_touchSleepEnable             DEFINE_NU_API(void (*)(Bool32),                                     99)
#define nu_TICommand_GetAPIs            DEFINE_NU_API(void ** (*)(void),                                    100)
//#define nu_KeypadCheckState             DEFINE_NU_API(unsigned char (*)(void),                              101)
#define nu_displaySetPartialUpdateAddr  DEFINE_NU_API(int (*)(int, int, int, int),                          102)
#define nu_bspDisplaySetRotationDegree  DEFINE_NU_API(int (*)(int),                                         103)
#define nu_bspDisplayEnableTeModeAndSetRotate   DEFINE_NU_API(void (*)(Uint32),                             104)
#define nu_bspDisplayDisableTeMode      DEFINE_NU_API(void (*)(void),                                       105)
#define nu_bspDisplayELcdDMACallbackReg DEFINE_NU_API(void(*)(bspDisplay_ELcdDMACallback, bspDisplay_ELcdDMACallback),                 106)
#define nu_notifyDeviceCallerByHISR     DEFINE_NU_API(void (*)(Uint32, Uint32),                             107)
#define nu_getTimer32kTicks             DEFINE_NU_API(void (*)(Uint32 *, Uint32 *),                         108)
#define nu_ExceptionHandler             DEFINE_NU_API(void (*)(Uint32 *, Uint8),                            109)
#define nu_GSensor_SetRotate            DEFINE_NU_API(void (*)(Uint8),                                      110)
//#define nu_FM4VIFI_GetAPIs              DEFINE_NU_API(void ** (*)(void),                                    111)
#define nu_GetPowerOnMode               DEFINE_NU_API(Uint32 (*)(void),                                     112)
#define nu_bspSoftwareReset             DEFINE_NU_API(void (*)(void),                                       113)
//#define nu_M4JPG_getEncoderVersion      DEFINE_NU_API(unsigned char(*)(M4JPG_Version *),                    114)
//#define nu_M4JPG_initEncoder            DEFINE_NU_API(unsigned char(*)(void **),                            115)
//#define nu_M4JPG_destroyEncoder         DEFINE_NU_API(unsigned char(*)(void *),                             116)
//#define nu_M4JPG_encode                 DEFINE_NU_API(unsigned char(*)(void *, M4JPG_Plane *, M4JPG_UInt32 *, M4JPG_UInt8 *), 117)
//#define nu_M4JPG_setEncoderParam        DEFINE_NU_API(unsigned char(*)(void *, M4JPG_EncParam *),           118)
//#define nu_LVM_GetVersionInfo           DEFINE_NU_API(LVM_ReturnStatus_en (*)(LVM_VersionInfo *),           119)
//#define nu_LVM_GetMemoryTable           DEFINE_NU_API(LVM_ReturnStatus_en (*)(LVM_Handle_t, LVM_MemTab_t *, LVM_InstParams_t *),  120)
//#define nu_LVM_GetInstanceHandle        DEFINE_NU_API(LVM_ReturnStatus_en (*)(LVM_Handle_t *, LVM_MemTab_t *, LVM_InstParams_t *),121)
//#define nu_LVM_ClearAudioBuffers        DEFINE_NU_API(LVM_ReturnStatus_en (*)(LVM_Handle_t),                122)
//#define nu_LVM_GetControlParameters     DEFINE_NU_API(LVM_ReturnStatus_en (*)(LVM_Handle_t, LVM_ControlParams_t *),            123)
//#define nu_LVM_SetControlParameters     DEFINE_NU_API(LVM_ReturnStatus_en (*)(LVM_Handle_t, LVM_ControlParams_t *),            124)
//#define nu_LVM_Process                  DEFINE_NU_API(LVM_ReturnStatus_en (*)(LVM_Handle_t, const LVM_INT16 *, LVM_INT16 *, LVM_UINT16), 125)
//#define nu_LVM_SetHeadroomParams        DEFINE_NU_API(LVM_ReturnStatus_en (*)(LVM_Handle_t, LVM_HeadroomParams_t *),            126)
//#define nu_LVM_GetHeadroomParams        DEFINE_NU_API(LVM_ReturnStatus_en (*)(LVM_Handle_t, LVM_HeadroomParams_t *),            127)
#define nu_Schedule_TimerControl        DEFINE_NU_API(int (*)(int),                                          128)
#define nu_bspPm_enableSleeps           DEFINE_NU_API(void (*)(Bool, Bool, Bool, Bool),                      129)
#define nu_bspIdle_Gsp_enableArmDeepSleepDecision    DEFINE_NU_API(void (*)(Bool),                           130)
//#define nu_allDevicesShundown           DEFINE_NU_API(void (*)(void),                                        131)
//#define nu_allDevicesPowerOn            DEFINE_NU_API(void (*)(void),                                        132)
#define nu_initUsbsync           DEFINE_NU_API(void (*)(void (*)(char *, int, int)),                        133)
#define nu_UsbsyncEnable         DEFINE_NU_API(void (*)(int),                                               134)
#define nu_diolink_write         DEFINE_NU_API(int (*)(void *, unsigned int *),                             135)
//#define nu_FM4ViDec_GetAPIs            DEFINE_NU_API(void ** (*)(void),                                      136)
#define nu_FM4ViEnc_GetAPIs            DEFINE_NU_API(void ** (*)(void),                                      137)
//#define nu_Audio_End                   DEFINE_NU_API(int (*)(unsigned char),                                138)
//#define nu_Audio_UpdateAppStatus       DEFINE_NU_API(int (*)(unsigned char, unsigned short,unsigned short, unsigned short, unsigned short),            139)
//#define nu_WMADec_GetAPIs              DEFINE_NU_API(void ** (*)(void),                                    140)
//#define nu_AACDec_GetAPIs              DEFINE_NU_API(void ** (*)(void),                                    141)
//#define nu_AMRNBDec_GetAPIs              DEFINE_NU_API(void ** (*)(void),                                    142)
//#define nu_AMRNBEnc_GetAPIs              DEFINE_NU_API(void ** (*)(void),                                    143)
#define nu_Get_UsbSyncReady            DEFINE_NU_API(int (*)(void),                                        144)
#define nu_GSensor_SetSensitivity              DEFINE_NU_API(void (*)(Uint8),                              145)
#define nu_RegisterSDCardEvent          DEFINE_NU_API(void (*)(int),                                       146)
#define nu_zenr_gbi_get_tfcard_blocks          DEFINE_NU_API(Uint32 (*)(void),                                       147)

void nu_accessDevice(Uint32 deviceType, nuDevice_Payload * payload);

#endif // _zener

#endif //__NU_API_H__
